<!DOCTYPE html>
<html>
<?
$allPlayers = getAllPlayers();
//usort($allPlayers, "compareAvailPlayers");
$reviewSuccess=false;

if (isset($_GET['reviewSuccess'])) {
	$reviewSuccess = true;	
}
?>
	<script>
		var allPlayers = new Array();
		<?$count = count($allPlayers);
		for ($i = 0; $i < $count; $i++) {?>
		allPlayers[<?echo $i?>] = new Player(<?echo $allPlayers[$i]->id?>, "<?echo $allPlayers[$i]->getDescription()?>");
		<?}?>
		
		function resetLists(frm) {
			frm.availPlayers.options.length = 0;
			document.getElementById('newPlayerDiv').innerHTML = "";
			frm.newPlayer.value = "";
			populateSelect(frm);
		}
	</script>

	<form id="reqFormForReview" action="kppStatusReview/submitAddReview.php">
	<table>
			<tr>
				<td><input type="text" onkeyup="filterSelect(this.value, this.form, true)"></input></td>
			</tr>
			<tr>
			<td>
				<select id="availPlayers" name="playerId" size="20" style="width: 270px;">
				</select> 
			</td>
		</tr>
		<tr>
			<td><input type="text" name="review" size=20 />&nbsp;<input type="submit" value="Submit" class="buttonStyle"></td>
		</tr>
	</table>
	</form>

<script>
populateSelect(document.getElementById("reqFormForReview"), true);
<?if ($reviewSuccess) {?>
	alert("Review successfully added!");
<?}?>
</script>